import React from 'react';
import { Layout } from 'antd';
import { Menu } from 'antd';
import { useHistory } from 'react-router-dom';
import RoutesViews from '../../router/RoutesViews';

const { Sider, Content } = Layout;

function getItem(label, key, icon, children) {
    return {
        key,
        icon,
        children,
        label,
    };
}

function EmployeeCenter(props) {
    var { routes } = props;
    var history = useHistory()

    const items = [
        getItem('员工管理', '/index/EmployeeCenter/StaffManage',),
        getItem('角色权限管理', '/index/EmployeeCenter/RoleManage',),
    ]

    var handleClick = ({ item, key, keyPath, domEvent }) => {
        history.push(key)
    }
    return (
        <div className='employee'>
            <Layout>
                <Sider>
                    <Menu
                        defaultSelectedKeys={['/index/EmployeeCenter/StaffManage']}
                        defaultOpenKeys={['sub1']}
                        items={items}
                        onClick={handleClick}
                    />
                </Sider>
                <Content style={{padding:'20px'}}>
                    {/* 三级路由渲染规则 */}
                    {/* <RoutesViews routes={routes}></RoutesViews> */}
                </Content>
            </Layout>

        </div>
    );
}

export default EmployeeCenter;